package user

import (
	"github.com/bgmp/config"
	"github.com/bgmp/handler"
	"github.com/bgmp/middleware"
	"github.com/bgmp/model"
	"github.com/gin-gonic/gin"
	log "github.com/sirupsen/logrus"
)

func (b Base) AddCaseHistory(c *gin.Context, req *AddCaseHistoryRequest) *AddCaseHistoryResponse {
	ch := model.CaseHistory{
		CaseHistoryMeta: model.CaseHistoryMeta{
			UserId: middleware.GetUserId(c),
		},
		CaseHistoryField: req.CaseHistoryField,
	}
	err := ch.Create(config.DB)
	if err != nil {
		handler.Errorf(c, "添加病程信息失败")
		log.Error(err)
		return nil
	}
	return &AddCaseHistoryResponse{}
}

type AddCaseHistoryRequest struct {
	model.CaseHistoryField
}

type AddCaseHistoryResponse struct {
}
